package at.stefanirndorfer.jframe;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;

import at.stefanirndorfer.lucene.Lucene;

public class SuchApplikationFrame extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JTextField txtEnterPathTo;
	private JTextField txtSearch;
	private JTextField txtResult;
	

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		
		
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					SuchApplikationFrame frame = new SuchApplikationFrame();
					frame.setVisible(true);
					Lucene lucene = new Lucene(frame);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		
	}

	/**
	 * Create the frame.
	 */
	public SuchApplikationFrame() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		
		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);
		
		JButton btnNewButton = new JButton("New button");
		menuBar.add(btnNewButton);
		//  indexer.indexFileOrDirectory(s);
		
		txtSearch = new JTextField();
		menuBar.add(txtSearch);
		txtSearch.setToolTipText("Enter search query here");
		txtSearch.setText("Search");
		txtSearch.setColumns(10);
		
		JMenuItem mntmNewMenuItem = new JMenuItem("Exit");
		menuBar.add(mntmNewMenuItem);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JLabel lblNewLabel = new JLabel("Search Documents");
		contentPane.add(lblNewLabel, BorderLayout.NORTH);
		
		txtEnterPathTo = new JTextField();
		txtEnterPathTo.setToolTipText("Enter path to file or drop file");
		txtEnterPathTo.setText("Add Document");
		contentPane.add(txtEnterPathTo, BorderLayout.WEST);
		txtEnterPathTo.setColumns(10);
		
		txtResult = new JTextField();
		txtResult.setText("Result");
		contentPane.add(txtResult, BorderLayout.CENTER);
		txtResult.setColumns(10);

	}

	public JTextField getTxtResult() {
		return txtResult;
	}
	
	public void setTxtResult(JTextField txtResult) {
		this.txtResult = txtResult;
	}

	
	
}
